package cn.tedu.springmvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

//@Controller
//如果当前类中所有方法，响应的结果，都直接回显到页面上
//@ResponseBody---》把当前起作用的注解，提取到类上方
//@ResponseBody
//组合注解---》封装 @Controller+@ResponseBody===》@RestController
@RestController
@RequestMapping("/base")
//@RequestMapping 可以加到类上方，效果：类的所有方法访问路径前，加上公共路径
//一级访问路径
public class HelloController {
    // http://localhost:9090/base/hello1
    @RequestMapping("/hello1")
    public String hello1(){
        System.out.println("接收到动态请求");
        return "hello1";
    }
    // http://localhost:9090/base/hello2
    @RequestMapping("/hello2")
    public String hello2(){
        System.out.println("接收到动态请求");
        return "hello2";
    }
    // http://localhost:9090/base/hello3
    @RequestMapping("/hello3")
    public String hello3(){
        System.out.println("接收到动态请求");
        return "hello3";
    }
}
